{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "1ad1c45a",
   "metadata": {},
   "source": [
    "## python练习题\n",
    "（一）有四个数字：1、2、3、4，能组成多少个互不相同且无重复数字的三位数？各是多少？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "4080a5c7",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1 2 3\n",
      "1 2 4\n",
      "1 3 2\n",
      "1 3 4\n",
      "1 4 2\n",
      "1 4 3\n",
      "2 1 3\n",
      "2 1 4\n",
      "2 3 1\n",
      "2 3 4\n",
      "2 4 1\n",
      "2 4 3\n",
      "3 1 2\n",
      "3 1 4\n",
      "3 2 1\n",
      "3 2 4\n",
      "3 4 1\n",
      "3 4 2\n",
      "4 1 2\n",
      "4 1 3\n",
      "4 2 1\n",
      "4 2 3\n",
      "4 3 1\n",
      "4 3 2\n"
     ]
    }
   ],
   "source": [
    "for i in range(1,5):\n",
    "    for j in range(1,5):\n",
    "        for k in range(1,5):\n",
    "            if (i!=k) and (i!=j) and (j!=k):\n",
    "                print(i,j,k)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e16b2f36",
   "metadata": {},
   "source": [
    "（二）企业发放的奖金根据利润提成。利润（1）低于或等于10万时，奖金可提10%；利润高于10万元时，低于10万元的部分10%提成，高于10万元的部分，可提成7.5%；20万到40万之间时，高于20万元的部分，可提成5%；40万到60万之间时高于40万元的部分，可提成3%；60万到100万之间时，高于60万元的部分，可提成1.5%，高于100万元时，超过100万元的部分按1%提成，从键盘输入当月利润！求应发放奖金总数？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "7fe8686e",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "输入你的利润值:2000000\n",
      "67500.0\n"
     ]
    }
   ],
   "source": [
    "i = int(input('输入你的利润值:'))\n",
    "arr = [1000000,6000000,4000000,200000,100000,0]\n",
    "rat = [0.01,0.015,0.03,0.05,0.075,0.1]\n",
    "result =0\n",
    "for idx in range(0,6):\n",
    "    if i > arr[idx]:\n",
    "        result +=(i-arr[idx]) * rat[idx]\n",
    "        i = arr[idx]\n",
    "\n",
    "print(result)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8faf998a",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
